/*
 Xern Entity Relocation Network
 Copyright (C) 2010-2011 Ronie Salgado <roniesalg@gmail.com>

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
*/

// Include the delegate dependency.
%include "MyGUI_Delegate.i"

// Include the EventPair definition.
%include "MyGUI_EventPair.h"

// The EventPair template requires some special methods for setting it.
%extend MyGUI::EventPair {
	void set(HSQUIRRELVM vm, HSQOBJECT env, HSQOBJECT func) {
		*$self = delegate_helper::CreateDelegate<Event > (vm, env, func); 
	}
	
	void set(HSQUIRRELVM vm, HSQOBJECT func) {
		HSQOBJECT env;
		
		sq_pushroottable(vm);
		sq_resetobject(&env);
		sq_getstackobj(vm, -1, &env);
		*$self = delegate_helper::CreateDelegate<Event > (vm, env, func);
		sq_pop(vm, 1); /* pop the root table*/
	}
}
